<template>
<h1>双向绑定指令</h1>
<!--1）info变量的数据发生变化，页面html的显示也会随之变化（Data Binding数据绑定）
    2）页面上的元素值发生变化，info变量的值也会随之改变（DOM Listener事件监听）-->
  <input type="text" v-model="info">
  {{info}}
  <hr>
  <input type="text" name="username" placeholder="请输入用户名" v-model="user.username">
  <input type="password" name="password" placeholder="请输入密码" v-model="user.password">
  <input type="radio" name="gender" value="1" v-model="user.gender">男
  <input type="radio" name="gender" value="0" v-model="user.gender">女
  <button @click="reg">注册</button>
</template>
<script setup>
import {ref} from "vue";

const info = ref('12.00');
const user = ref({
  username:'',
  password:'',
  gender:''
});
const reg = ()=>{
  console.log(user.value);
  console.log(user.value.username);
  console.log(user.value.password);
  console.log(user.value.gender);
};
const reg1 = function(){

}
</script>


<style scoped>

</style>